<template>
  <div class="homeView">
    <div v-for="item in list" :key="item.jsaCode">
      {{item.jsaName}}
    </div>
  </div>
</template>

<script>
import { mapActions } from 'vuex'
export default {
  data () {
    return {
      list: [
        {
          jsaCode: 'JSA-24-0109002',
          jsaName: '测试二级动火作业回归',
          jsaDescribe: '这是看任务的描述',
          department: '585326155461033984',
          departmentName: '羊羊专用部门',
          facilityId: '585324157730816000',
          facilityType: '16',
          facilityName: '羊羊专用数据',
          workLocation: '这是作业位置',
          workType: '615664465391648768',
          planStart: '2024-01-09 08:00:00',
          planEnd: '2024-01-09 17:00:00'
        },
        {
          jsaCode: 'JSA-24-0105001',
          jsaName: 'qy-验证测试-01',
          jsaDescribe: 'qy-验证测试-01',
          department: '126218685739171840',
          departmentName: '生产运营部',
          facilityId: '574160676382048257',
          facilityType: '13',
          facilityName: '825导入罐区2',
          workLocation: '测试位置',
          workType: '614614319417524224',
          planStart: '2024-01-05 08:00:00',
          planEnd: '2024-01-06 17:00:00'
        },
        {
          jsaCode: 'JSA-23-1227007',
          jsaName: 'qy-受限空间作业票-003',
          jsaDescribe: 'qy-受限空间作业票-003',
          department: '126218685739171840',
          departmentName: '生产运营部',
          facilityId: '574159458616213505',
          facilityType: '16',
          facilityName: '825导入生产单元2',
          workLocation: 'weizhi',
          workType: '614615001138724864',
          planStart: '2023-12-27 19:39:45',
          planEnd: '2023-12-28 17:00:00'
        }
      ]
    }
  },
  computed: {
    filteredList () {
      return this.list.filter(item => item.facilityType === '16')
    }
  },
  methods: {
    ...mapActions(['setFacilityData']),
    handleFilteredList () {
      this.filteredList.forEach(item => {
        // 存到store中
        this.setFacilityData({ id: item.facilityId, data: item })
      })
    }
  },
  mounted () {
    this.handleFilteredList()
  }
}
</script>

<style lang="scss" scoped>

</style>
